
import {Point} from '@/assets/js/Point'

class Chessboard {
  constructor () {
    this.points = [];
    this.lines = [];

    // 第一行
    this.points[0] = new Point(11, 0, 41, 71, 0, 14, 17, 0, 0);
    this.points[1] = new Point(41, 11, 0, 71, 0, 42, 43, 3, 0);
    this.points[2] = new Point(71, 11, 41, 0, 0, 74, 77, 6, 0);

    // 第二行
    this.points[3] = new Point(22, 0, 42, 62, 0, 24, 26, 1, 1);
    this.points[4] = new Point(42, 22, 0, 62, 41, 0, 43, 3, 1);
    this.points[5] = new Point(62, 22, 42, 0, 0, 64, 66, 5, 1);

    // 第三行
    this.points[6] = new Point(33, 0, 43, 53, 0, 34, 35, 2, 2);
    this.points[7] = new Point(43, 33, 0, 53, 41, 42, 0, 3, 2);
    this.points[8] = new Point(53, 33, 43, 0, 0, 54, 55, 4, 2);

    // 第四行 左
    this.points[9] = new Point(14, 0, 24, 34, 11, 0, 17, 0, 3);
    this.points[10] = new Point(24, 14, 0, 34, 22, 0, 26, 1, 3);
    this.points[11] = new Point(34, 14, 24, 0, 33, 0, 35, 2, 3);

    // 第四行 右
    this.points[12] = new Point(54, 0, 64, 74, 53, 0, 55, 4, 3);
    this.points[13] = new Point(64, 54, 0, 74, 62, 0, 66, 5, 3);
    this.points[14] = new Point(74, 54, 64, 0, 71, 0, 77, 6, 3);

    // 第五行
    this.points[15] = new Point(35, 0, 45, 55, 33, 34, 0, 2, 4);
    this.points[16] = new Point(45, 35, 0, 55, 0, 46, 47, 3, 4);
    this.points[17] = new Point(55, 35, 45, 0, 53, 54, 0, 4, 4);

    // 第六行
    this.points[18] = new Point(26, 0, 46, 66, 22, 24, 0, 1, 5);
    this.points[19] = new Point(46, 26, 0, 66, 45, 0, 47, 3, 5);
    this.points[20] = new Point(66, 26, 46, 0, 62, 64, 0, 5, 5);

    // 第七行
    this.points[21] = new Point(17, 0, 47, 77, 11, 14, 0, 0, 6);
    this.points[22] = new Point(47, 17, 0, 77, 45, 46, 0, 3, 6);
    this.points[23] = new Point(77, 17, 47, 0, 71, 74, 0, 6, 6);

    this.lines[0] = 'M' + this.points[0].location.x + ' ' + this.points[0].location.y + ' H' + this.points[2].location.x;
    this.lines[1] = 'M' + this.points[2].location.x + ' ' + this.points[2].location.y + ' V' + this.points[23].location.y;
    this.lines[2] = 'M' + this.points[21].location.x + ' ' + this.points[21].location.y + ' H' + this.points[23].location.y;
    this.lines[3] = 'M' + this.points[0].location.x + ' ' + this.points[0].location.y + ' V' + this.points[21].location.x + ' ' + this.points[21].location.y;

    this.lines[4] = 'M' + this.points[3].location.x + ' ' + this.points[3].location.y + ' H' + this.points[5].location.x + ' ' + this.points[5].location.y;
    this.lines[5] = 'M' + this.points[5].location.x + ' ' + this.points[5].location.y + ' V' + this.points[20].location.x + ' ' + this.points[20].location.y;
    this.lines[6] = 'M' + this.points[18].location.x + ' ' + this.points[18].location.y + ' H' + this.points[20].location.x + ' ' + this.points[20].location.y;
    this.lines[7] = 'M' + this.points[3].location.x + ' ' + this.points[3].location.y + ' V' + this.points[18].location.x + ' ' + this.points[18].location.y;

    this.lines[8] = 'M' + this.points[6].location.x + ' ' + this.points[6].location.y + ' H' + this.points[8].location.x + ' ' + this.points[8].location.y;
    this.lines[9] = 'M' + this.points[8].location.x + ' ' + this.points[8].location.y + ' V' + this.points[17].location.x + ' ' + this.points[17].location.y;
    this.lines[10] = 'M' + this.points[15].location.x + ' ' + this.points[15].location.y + ' H' + this.points[17].location.x + ' ' + this.points[17].location.y;
    this.lines[11] = 'M' + this.points[6].location.x + ' ' + this.points[6].location.y + ' V' + this.points[15].location.x + ' ' + this.points[15].location.y;

    this.lines[12] = 'M' + this.points[1].location.x + ' ' + this.points[1].location.y + ' V' + this.points[7].location.y;
    this.lines[13] = 'M' + this.points[12].location.x + ' ' + this.points[12].location.y + ' H' + this.points[14].location.x;
    this.lines[14] = 'M' + this.points[16].location.x + ' ' + this.points[16].location.y + ' V' + this.points[22].location.y;
    this.lines[15] = 'M' + this.points[9].location.x + ' ' + this.points[9].location.y + ' H' + this.points[11].location.x
  }
}

export { Chessboard }
